package com.sky.enumeration;

/**
 * 状态描述管理器
 * 用于管理各种状态码和对应的中文描述
 */
public class StatusDescriptionManager {

    /**
     * 根据状态类型和状态码获取描述
     */
    public static String getDescription(String statusType, Integer statusCode) {
        if (statusCode == null) {
            return "";
        }

        switch (statusType) {
            case "COMPETITION_CATEGORY":
                return CompetitionCategoryStatus.getDescriptionByCode(statusCode);
            case "COMPETITION":
                return CompetitionStatus.getDescriptionByCode(statusCode);
            case "REVIEW_LEVEL":
                return getReviewLevelDescription(statusCode);
            case "APPLICATION_STATUS":
                return getApplicationStatusDescription(statusCode);
            case "PUBLISH_STATUS":
                return getPublishStatusDescription(statusCode);
            case "SUBMIT_STATUS":
                return getSubmitStatusDescription(statusCode);
            default:
                return "未知状态";
        }
    }

    /**
     * 获取审核级别描述
     */
    private static String getReviewLevelDescription(Integer code) {
        switch (code) {
            case 0: return "学校审核";
            case 1: return "部门审核";
            case 2: return "教师申请";
            default: return "未知级别";
        }
    }

    /**
     * 获取申请状态描述
     */
    private static String getApplicationStatusDescription(Integer code) {
        switch (code) {
            case 0: return "申请中";
            case 1: return "部门审批中";
            case 2: return "部门审批通过";
            case 3: return "部门审批不通过";
            case 4: return "学校审批中";
            case 5: return "学校审批通过";
            case 6: return "学校审批不通过";
            default: return "未知状态";
        }
    }

    /**
     * 获取发布状态描述
     */
    private static String getPublishStatusDescription(Integer code) {
        switch (code) {
            case 0: return "未发布";
            case 1: return "已发布";
            default: return "未知状态";
        }
    }

    /**
     * 获取提交状态描述
     */
    private static String getSubmitStatusDescription(Integer code) {
        switch (code) {
            case 0: return "未提交";
            case 1: return "已提交";
            default: return "未知状态";
        }
    }

    /**
     * 获取指定状态类型的所有状态选项
     * 用于前端下拉框等场景
     */
    public static java.util.Map<Integer, String> getStatusOptions(String statusType) {
        java.util.Map<Integer, String> options = new java.util.HashMap<>();

        switch (statusType) {
            case "COMPETITION_CATEGORY":
                for (CompetitionCategoryStatus status : CompetitionCategoryStatus.values()) {
                    options.put(status.getCode(), status.getDescription());
                }
                break;
            case "COMPETITION":
                for (CompetitionStatus status : CompetitionStatus.values()) {
                    options.put(status.getCode(), status.getDescription());
                }
                break;
            case "REVIEW_LEVEL":
                options.put(0, "学校审核");
                options.put(1, "部门审核");
                options.put(2, "教师申请");
                break;
            case "APPLICATION_STATUS":
                options.put(0, "申请中");
                options.put(1, "部门审批中");
                options.put(2, "部门审批通过");
                options.put(3, "部门审批不通过");
                options.put(4, "学校审批中");
                options.put(5, "学校审批通过");
                options.put(6, "学校审批不通过");
                break;
            case "PUBLISH_STATUS":
                options.put(0, "未发布");
                options.put(1, "已发布");
                break;
            case "SUBMIT_STATUS":
                options.put(0, "未提交");
                options.put(1, "已提交");
                break;
        }

        return options;
    }
}
